Skip to content

Fake-engine tests no longer load the RAMSES library - #9

Merged
apetros merged 1 commit into
masterfrom
fix/fake-engine-no-dll
Nov 20, 2026
Merged

apetros merged 1 commit into
masterfrom
fix/fake-engine-no-dll

Conversation

@apetros

@apetros apetros commented Nov 20, 2026

Copy link
Copy Markdown
Member

Problem

The Tests run on master after #8 was merged failed on windows-latest / Python 3.12 only: four tests in tests/test_ssa_engine.py found the engine already at t = 0.0021 s or 0.5 s, where each kundur fixture expects a fresh simulation. The other five legs passed, and the same leg passed in the v3.85 release gate a few minutes later, so it is intermittent.

Likely cause

The STOP-check tests added in #8 built a real stepss.sim() and swapped its library for a fake, so each held a reference to the RAMSES DLL while the object lived. A test that raises keeps the object alive through the exception's traceback until the garbage collector runs. On Windows the DLL is unloaded, and its Fortran state reset, only when the last reference goes, and test_ssa_engine.py relies on that reset. I have not reproduced it on Windows; the intermittency and the 3.12-only leg are consistent with collection timing.

Change

FakeSim subclasses sim without calling its __init__ and its __del__ unloads nothing, so these tests never load the library at all.

Verified

Full suite locally on macOS, Python 3.14: 262 passed, 1 failed (test_tar_round_trip_without_the_extraction_filter, a Python 3.14 tarfile issue that fails on master too). The Windows legs of this PR's Tests run are the real check.

The STOP-check tests built a real stepss.sim() and swapped its library
for a fake, so each held a reference to the RAMSES DLL for as long as
the object lived. A test that raises keeps the object alive through the
exception's traceback until the garbage collector runs. On Windows the
DLL is only unloaded, and its Fortran state reset, when the last
reference goes, and test_ssa_engine.py relies on that reset between
fixtures: on master after the merge, windows-latest with Python 3.12
found the previous test's simulation still at t = 0.5 s, while the
other five legs passed, and the same leg passed in the v3.85 release
gate. A late collection is the likely cause.

FakeSim subclasses sim without calling its __init__ and unloads
nothing, so these tests cannot hold the library at all.
@apetros
apetros merged commit 3017324 into master Nov 20, 2026
6 checks passed
@apetros
apetros deleted the fix/fake-engine-no-dll branch November 20, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant